# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=python2-dbus
_pkgname=dbus-python
pkgver=1.2.18
pkgrel=2
pkgdesc='Python bindings for libdbus'
url='https://pypi.org/project/dbus/#files'
arch=('x86_64' 'aarch64')
license=('custom:MIT')
depends=('python2' 'python-dbus-common')
makedepends=('python2-setuptools')
source=("https://dbus.freedesktop.org/releases/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('72f422c59637392bd78b741b66dff2afadcc706452c3e82fdc14b1dc052a0c5cb8a85e2758d18c5cbdc08004419a0b3c16b67b99688d96307084403e72585900')

prepare() {
  cd "$_pkgname-$pkgver"

  autoreconf -fi
}

build() {
  cd "$_pkgname-$pkgver"

  PYTHON=/usr/bin/python2 PYTHON_VERSION=2 ./configure --prefix=/usr
  sed -i -e 's| -shared | -Wl,-O1,--as-needed\0|g' libtool

  make
}

package() {
  cd "$_pkgname-$pkgver"

  make DESTDIR="$pkgdir" install

  rm -rf "$pkgdir/usr/"{share,include,lib/pkgconfig}
}

